home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: leeds.ac.uk!news
- From: vct@scs.leeds.ac.uk (V Times)
- Subject: Weird Syntax error (Undeclared identifier)
- Message-ID: <1996Feb22.114420.25783@leeds.ac.uk>
- NNTP-Posting-Host: csgi48.leeds.ac.uk
- Organization: The University of Leeds, School of Computer Studies
- Date: Thu, 22 Feb 1996 11:44:20 +0000 (GMT)
-
- Hi !
-
- I am having a strange compiling error. I have defined a class BUT I can not create an object of that
- class. It is giving me an error (please refer to the code below).
-
- Can someone tell me the cause of the error?
-
- Thanks,
-
- Valeria
-
- ps Please send your reply directly to me (I seldom read the newsgroup).
-
- >==============================================================
- >
- > case POLYLINE:
- > {
- >line 189 Polyline pl;
- > for (long int i = 0;i <= nSegs; i++)
- > {
- > ar >> x >> y;
- >line 193 pl.AddNew(x,y);
- > TRACE1 ("Ok. X_Coordinate read: %d \n",x);
- > TRACE1 ("Ok. Y_Coordinate read: %d \n",y);
- > }
- > }
- > break;
- >
- >C:\tmp\vct\Operators\Operadoc.cpp(189) : error C2146: syntax error : missing
- >';' before identifier 'pl'
- >C:\tmp\vct\Operators\Operadoc.cpp(189) : error C2065: 'pl' : undeclared
- >identifier
- >C:\tmp\vct\Operators\Operadoc.cpp(193) : error C2228: left of '.AddNew' must
- >have class/struct/union type
- >
- >
- >/* Class Polyline is defined as follows. */
- >
- >
- >class Polyline : public SpatialObject
- >{
- >/*
- > Draws a polyline composed by a number n
- > of segments contained in the array segs.
- >*/
- >
- > protected:
- >
- > public:
- >// Polyline () {}
- >
- > /* > Draw object to display */
- > void Display (CDC*) ;
- >
- > /* Show contents of object */
- > virtual void Show () ;
- >
- > /* Destructor function */
- > ~Polyline() {TRACE0 ("~Polyline ()\n");}
- >} ;
-